package com.vdongchina.miniapp.http.service;

import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient;
import com.vdongchina.miniapp.constants.MiniAppConstants;
import com.vdongchina.miniapp.http.dto.*;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Copyright (C)
 * FileName: MiniPayService
 * Author:   maokai
 * Date:     2021/8/12 15:46
 * Description:
 */
@RetrofitClient(baseUrl = "https://developer.toutiao.com/")
public interface IPayHttpService extends IAppService {
    /**
     * 支付下单
     */
    @POST(MiniAppConstants.OrderConstants.CREATE_ORDER)
    Call<CreateOrderResp> createOrder(@Body CreateOrderRequest request);

    /**
     * 订单查询
     */
    @POST(MiniAppConstants.OrderConstants.QUERY_ORDER)
    Call<QueryOrderResp> queryOrder(@Body QueryOrderRequest request);

    /**
     * 退款请求
     */
    @POST(MiniAppConstants.OrderConstants.CREATE_REFUND)
    Call<CreateRefundResp> createRefund(@Body CreateRefundRequest request);

    /**
     * 查询退款
     */
    @POST(MiniAppConstants.OrderConstants.QUERY_REFUND)
    Call<QueryRefundResp> queryRefund(@Body QueryRefundRequest request);

    /**
     * 分账
     */
    @POST(MiniAppConstants.OrderConstants.SETTLE)
    Call<SettleResp> settle(@Body SettleRequest request);

    /**
     * 查询分账
     */
    @POST(MiniAppConstants.OrderConstants.QUERY_SETTLE)
    Call<QuerySettleResp> querySettle(@Body QuerySettleRequest request);

    /**
     * 担保交易账单查询
     * @param startDate 开始时间，格式：20210603
     * @param endDate 结束时间，格式：20210603
     * @param seller 商户号
     * @param billType 账单类型，包括 payment:支付账单, settle:分账账单, refund:退款账单
     * @param appId 和商户号绑定的 appid 或者 thirdparty_id
     * @param sign 对上面的参数进行签名
     */

    @GET(MiniAppConstants.OrderConstants.BILL)
    Call<BillResp> bill(@Query(value = "start_date") String startDate,
                                     @Query(value = "end_date") String endDate,
                                     @Query(value = "seller") String seller,
                                     @Query(value = "bill_type") String billType,
                                     @Query(value = "app_id") String appId,
                                     @Query(value = "sign") String sign);
}
